package D2;

import java.time.LocalDate;
import java.time.LocalDateTime;

public class Java08 {
    public static void main(String[] args) {
        //0、获取本地日期和时间对象
        LocalDateTime idt = LocalDateTime.now();
        System.out.println(idt);
        //1、获取日期时间的全部信息
        int year = idt.getYear();
        int month = idt.getMonthValue();
        int day = idt.getDayOfMonth();
        int daypfyear = idt.getDayOfYear();
        int dayofweek = idt.getDayOfWeek().getValue();
        int hour = idt.getHour();
        int minute = idt.getMinute();
        int s = idt.getSecond();
        int n = idt.getNano();
        //修改时间信息
        LocalDateTime idt2 = idt.withYear(2009);
        LocalDateTime idt3 = idt.withMinute(23);
        //3、加多少
        LocalDateTime idt4 = idt.plusYears(10);
        //4、减多少
        LocalDateTime idt5 = idt.minusMonths(100000);
        //5、获取指定日期和时间的对象
        LocalDateTime idt8 = LocalDateTime.of(2024,10,26,26,26,26,26);
        //6、判断两个日期、时间对象在前还是在后
        System.out.println(idt.equals(idt3));
        //7、可以把LocalDateTime转换成LocalDate和LocalTime
        LocalDate ID = idt.toLocalDate();


    }
}
